<template>
	<div id="building">
	<div id="container">
		<div id="container">
		<el-form label-width="80px" style="width: 85%">
			<el-form-item label="职位:">
				<el-input placeholder="输入职位" v-model="staff.p_name"></el-input>
			</el-form-item>
			<el-form-item label="姓名:">
				<el-input placeholder="输入姓名" v-model="staff.staff_name"></el-input>
			</el-form-item>
			<el-form-item label="编号:">
				<el-input placeholder="输入编号" v-model="staff.staff_no"></el-input>
			</el-form-item>
			<el-form-item label="性别:">
				<el-input placeholder="输入性别" v-model="staff.staff_sex"></el-input>
			</el-form-item>
			<el-form-item label="手机号:">
				<el-input placeholder="输入手机号" v-model="staff.staff_phone"></el-input>
			</el-form-item>
			<el-form-item label="部门:">
				<el-select placeholder="请选择" style="width: 100%" v-model="staff.staff_department">
					<el-option label="人事部" value="人事部"></el-option>
					<el-option label="市场部" value="市场部"></el-option>
					<el-option label="财务部" value="财务部"></el-option>
					<el-option label="公关部" value="公关部"></el-option>
					<el-option label="设计部" value="设计部"></el-option>
					<el-option label="技术部" value="技术部"></el-option>
					<el-option label="卫生部" value="卫生部"></el-option>
				</el-select>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" @click="add()">入职</el-button>
			</el-form-item>
		</el-form>
		</div>
	</div>
	</div>
</template>

<script>
	export default{
		name:'UserRegView',
		data(){
			return {
				staff:{
					p_name:'',
					staff_name:'',
					staff_no:'',
					staff_sex:'',
					staff_phone:'',
					staff_status:'实习',
					staff_department:''
				}
			}
		},
		methods:{
			add(){
				
				this.$axios.post("http://localhost:8088/eStaff/user/reg",this.staff)
				.then(rst=>{
					if(rst.data.code==200){
						//this.$message("操作结束");
						this.$alert("操作成功","提示");
					}else{
						alert("操作失败")
					}
				}).catch(err=>{
					alert("工号重复");
				})
				
			}
		}
	}
</script>

<style scoped>
	#building{
	  background:url("../../assets/back.jpg");
	  width:80%;
	  height:80%;
	  position:fixed;
	  background-size:100% 100%;
	}
</style>